<%--
 *  File:    searchresultsummary.jsp
 *  @Author: banshang	
 *  Date:    2010/6/25
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.PeriodManageSummary");
  String strModuleName = "IMG";
  String strTableName = "v_zylperiodmanagersummary";
  String privilegeCode = "Z0700";
  String contextPath = request.getContextPath();

%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@include file="/inc/Print.inc"%>
<html>
<head>
<title>PeriodManageSummary</title>
<PageFlow:CheckPageFlow pageName="p_zylperiodmanagersummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/cn/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
	<%@ include file="/inc/NewCalendar.inc" %>
<%
	Vector searchresults = (Vector)pageContext.getAttribute("searchresults");
	if(searchresults == null) searchresults = new Vector();
%>
<script>
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "PeriodManageSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}
function clickRow(id)
{
  document.cform.periodmanagerid.value = id;
}


function monthresult(){
	var periodmanagerid = document.cform.periodmanagerid.value;
	var cstatusname="status"+Number(periodmanagerid);
	var cstatusObj =eval("document.cform."+cstatusname);
	if (cstatusObj.value==43){
	 document.cform.actionname.value = "save";
	 document.cform.target="_self";
	 isRunning = true;
	 document.cform.submit();
	}else {
	alert ("请选择启用状态的期间月结!");
	return ;
	}
	  
/*	var datahandler = new  DataHandler() ;
    datahandler.add_params("lnum" , lnum, 'Integer') ;
    datahandler.add_params("cnum" , periodmanagerid, 'Integer') ;
    datahandler.getResult("monthflag" ,"document.cform.monthflag");
   
    datahandler.add_job("j_zylcheckmonthresult");
    datahandler.add_function("page_checkFlag()");
    datahandler.runDataHandler();
    */
/*	var lnum = Number(periodmanagerid)-1;
var statusname="status"+lnum;
	var cstatusname="status"+Number(periodmanagerid);
	
	var statusObj =eval("document.cform."+statusname);
	alert(statusObj);
	var cstatusObj =eval("document.cform."+cstatusname);
	alert(statusObj.value);
	alert(cstatusObj.value);
	
	if ((statusObj.value==43) &&(cstatusObj.value==27)){
	 alert("ok");
	return ;
	}else {
	alert ("请选择未用期间月结!");
	return ;
	}
	
	*/
	
}
function page_checkFlag(){

   if (document.cform.monthflag.value=="Y") {
	  document.cform.actionname.value = "save";
	document.cform.target="_self";
	isRunning = true;
	document.cform.submit();
	} else{
	alert ("请选择正确的期间月结!(当前选择期间是未用状态且当前选择期间的上条期间是启用状态)");
	return ;
	}
}
window.onload=function(){
          // cform.startdate.value=new Date().toFormatString("yyyy-mm-dd");
          // cform.enddate.value=new Date().toFormatString("yyyy-mm-dd");
}
</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
		    <input type="hidden" name="pagename" value="p_zylperiodmanagersummary">
		    <input type="hidden" name="actionname">
		    <input type="hidden" name="IsEdit">
		    <input type="hidden" name="monthflag">



<table width="100%" cellspacing="0">
  <% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
</table>
	<table width="100%">
		 <tr>
    <td> 
      <table width="100%" border="0" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center" 
                    style="background:url(<%= contextPath %>/images/<%= strLanguageCode %>/title_2_bg.jpg) repeat-x; " height="36">  
         <tr onkeydown="if(event.keyCode==13) page_go();">
         <!-- 
    <td width="8%" class="td_right"><%= label.getLabelName("L_Year") + label.getLabelName("L_Colon") %></td>
         <td width="10%" class="td_center"><custom:text property="year" readonly="false" size="15"/></td>
         <td width="8%" class="td_right"><%= label.getLabelName("L_Month") + label.getLabelName("L_Colon") %></td>
         <td width="10%" class="td_center"><custom:text property="month" readonly="false" size="10"/></td>
     -->
         <td width="8%" class="td_right"><%= label.getLabelName("L_StartTime") + label.getLabelName("L_Colon") %></td>
         <td width="14%" class="td_center"> 
              	<custom:text property="startdate1" dataType="date" readonly="true" dataFormat="dataformat" />
              	&nbsp;<a onclick="javascript:c.show(this,'cform.startdate1','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
         </td>
		 <td width="8%" class="td_right"><%= label.getLabelName("L_EndTime") + label.getLabelName("L_Colon") %></td>
         <td width="14%" class="td_center"> 
              	<custom:text property="enddate1" dataType="date" readonly="true" dataFormat="dataformat" />
              	&nbsp;<a onclick="javascript:c.show(this,'cform.enddate1','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
         </td>
         	<!--
            <td width="6%" class="td_right"><%= label.getLabelName("L_InventoryStatus") + label.getLabelName("L_Colon") %></td>
			<td width="5%"><custom:selectdic dictType="YesOrNo" property="invstatus" defaultValue="------" defaultValueCost = " " /></td>
			-->
			
			
         	<td><a href="javascript:page_summary('search')"><img src="<%= contextPath %>/images/<%= strLanguageCode %>/go_fy.gif" border="0" style="border: 1 solid #000000"></a></td>
         <td width="*%" class="td_right">&nbsp;</td>
         </tr>
	</table>
      <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellpadding="0" width="100%">


          <tr class="deepblue-left">
            <td width="22" class="title_center" >&nbsp;</td>
              <td width="10%" class="title_center" ><%= label.getLabelName("L_SN") %></td>
            <td width="10%" class="title_center" ><a href="javascript:page_summary('orderby','year')"><%= label.getLabelName("L_Year") %></a></td>
            <td width="10%" class="title_center" ><a href="javascript:page_summary('orderby','month')"><%= label.getLabelName("L_Month") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','startdate')"><%= label.getLabelName("L_StartTime") %></a></td>
            <td width="10%" class="title_center"><a href="javascript:page_summary('orderby','enddate')"><%= label.getLabelName("L_EndTime") %></a></td>
            <td width="10%" class="title_center" ><a href="javascript:page_summary('orderby','datelastupdate')"><%= label.getLabelName("L_Datelastupdate") %></a></td>
			<td width="10%" class="title_center"><a href="javascript:page_summary('orderby','valuename')"><%= label.getLabelName("L_Status") %></td>
          </tr>
          <%
             int j = 0;
          int s=1;
             String strClassType = new String();
             String strIsChecked = "";
             Integer defaultId = new Integer(-1);
             boolean bHasChecked = false;
            
          %>
          <logic:iterate id="pageconfig" collection="<%= searchresults %>">
          	<%
            HashMap pageConfig = (HashMap)pageContext.getAttribute("pageconfig");
            if(j%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "";
            }

           if(!bHasChecked)
            {
              strIsChecked = "Checked";
              defaultId = (Integer)pageConfig.get("periodmanagerid");
              bHasChecked = true;
              
            }else{
           		strIsChecked = "";
            }
           s= ((Integer)pageConfig.get("periodmanagerid")).intValue();
            j++;
          %>
          	<tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>"
          		onclick="javascript:radiotrue('radio<%=JspHelper.filterNull(j )%>');clickRow('<custom:write name="pageconfig" property="periodmanagerid" nbsp="true"/>')"
          		>
	            <td width="5%">
	              <input class="normalradio" id="radio<%=JspHelper.filterNull(j )%>" type="radio" name="pageconfig" changedName="fileids" <%=JspHelper.filterNull( strIsChecked)%>>
	            </td>
	            <td>
	            <custom:write name="pageconfig" property="periodmanagerid"/>
	            </td>
    	  <% 
    	     String statusvalue = pageConfig.get("status") + "";
    	  if("27".equals(statusvalue)) {%>
	             <td>&nbsp;<custom:text name="pageconfig" property="year" size="15"/></td>
	            <td>&nbsp;<custom:text name="pageconfig" property="month" size="15"/></td>
	            <td>&nbsp;<custom:text  name="pageconfig" property="startdate" size="15"/></td>
	            <td>&nbsp;<custom:text  name="pageconfig" property="enddate" size="15"/></td>
	            	<%}else{%>
	            <td>&nbsp;<custom:write name="pageconfig" property="year" nbsp="true"/></td>
	            <td>&nbsp;<custom:write name="pageconfig" property="month" nbsp="true"/></td>
	            <td>&nbsp;<custom:write  name="pageconfig" property="startdate" nbsp="true"/></td>
	            <td>&nbsp;<custom:write  name="pageconfig" property="enddate" nbsp="true"/></td>
	            		<%}%>
		        
	            <td>&nbsp;<custom:write name="pageconfig" property="datelastupdate" nbsp="true"/></td>
	          <td>&nbsp;<custom:write  name="pageconfig" property="valuename" nbsp="true"/>
	          		<custom:hidden property="status" name="pageconfig" colIndex="<%=new Integer(s)%>"/>
	          		</td>
	         </tr>
          </logic:iterate>
           
          
          <input type="hidden" name="periodmanagerid" value="<%=JspHelper.filterNull( defaultId )%>">
          

    <% //--------------------------------------  flipping page --%>
    <%@ include file="/inc/SummaryAction.inc" %>
    <table width="100%">
        <tr> 
          <td class="summary_top"></td>
        </tr>
		<tr >
			<td class="td_center">
	            <a onclick="monthresult()"><custom:button type="1" label="L_MonthAS" imgsrc="new.gif" border="0" style="width:60"/></a>
	     
	          </td>
	          
		</tr>
	</table>	
   </table>
</form>
</table>


</body>
</html>


